package servlets;

import junit.framework.TestCase;

import org.junit.Test;

/**
 * class AuthenticationServletTest - JUnit for user and password validation (authentication)
 */
public class AuthenticationServletTest extends TestCase {
	
	AuthenticationServlet authenticationServlet;
	
	protected void setUp(){
		authenticationServlet=new AuthenticationServlet();
	}
	
	@Test
	/**
	 * check true user and password
	 */
	public void testTruePassword() {
		assertEquals("true", authenticationServlet.checkPassword("aa","bb"));
	}
	
	@Test
	/**
	 * check user and wrong password
	 */
	public void testWrongPassword() {
		assertEquals("wrong password", authenticationServlet.checkPassword("aa","cc"));
	}
	
	@Test
	/**
	 * check when there is no such user
	 */
	public void testNoUser() {
		assertEquals("user not exist", authenticationServlet.checkPassword("bb","bb"));
	}

}
